#!/usr/bin/env python
# encoding: utf-8
# @Time : 2020/4/23 11:38 
# @Author : 能量咖啡豆 
# @File : 70.py 
# @desc : leetcode 70. 爬楼梯
"""
利用斐波那契数列求解，利用迭代解决
"""
def solution1(n):
    if n <= 2:
        return n
    f1 = 1
    f2 = 2
    for i in range(3,n+1):
        fn = f1+f2
        f1 = f2
        f2 = fn

    return fn

"""
利用斐波那契数列求解，利用递归简单方便且粗暴
"""
def solution(n):
    if n <= 2:
        return n
    return solution(n-1)+solution(n-2)


if __name__ == "__main__":
    print("hello")
    print(solution1(5))
